<%@ page language="java"
	import="java.util.*,com.tjsinfo.tjsoa.common.PaginationSupport"
	pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingRoomEmploy"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingIncept"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

	PaginationSupport paginationSupport1 = (PaginationSupport) session.getAttribute("myMeetingList1");
	List<MeetingRoomEmploy> infos1 = paginationSupport1.getItems();
	String pageNoStr1 = request.getParameter("pageNo1");
	if (pageNoStr1 == null)
	pageNoStr1 = "0";
	Integer pageNo1 = Integer.valueOf(pageNoStr1);
	
	PaginationSupport paginationSupport2 = (PaginationSupport) request.getAttribute("myMeetingList2");
	List<MeetingIncept> infos2 = paginationSupport2.getItems();
	String pageNoStr2 = request.getParameter("pageNo2");
	if (pageNoStr2 == null)
	pageNoStr2 = "0";
	Integer pageNo2 = Integer.valueOf(pageNoStr2);
	
	List<MeetingRoomEmploy> roomList = (List<MeetingRoomEmploy>)request.getAttribute("roomList");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <base href="<%=basePath%>"/>
    <link href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
<style>
.sss td{
	padding: 2px 5px 2px 10px;
	line-height: 20px;
}
</style>
 
    <script type="text/javascript">
    function submitpages1(value){
		if(value==-1){
			Ext.MessageBox.alert('提示框','<nobr>请重新选择页码</nobr>');
			return ;
		}
		window.location.href='<%=basePath%>tjsinfo/tjsoa/meetingroom/myMeeting.do?pageNo1='+value+'';
	}
    function submitpages2(value){
		if(value==-1){
			Ext.MessageBox.alert('提示框','<nobr>请重新选择页码</nobr>');
			return ;
		}
		window.location.href='<%=basePath%>tjsinfo/tjsoa/meetingroom/myMeeting.do?pageNo2='+value+'';
	}
    
    	var array = null;
    	function initarray(){
    		$("#rightindex").css("height",$("#component").height()-20);
    		$("tr:odd").css('background-color','#E7F6FB');
    	}
    	
    	function typeselect(){
    		var item = $("select[@name=maintype] option[@selected]").attr("value");		    	
    		$.get("<%=basePath%>tjsinfo/tjsoa/xingzhengfawen/selectMainTypeById.do",{id:item},function(data){
						var obj =  Ext.decode(data);
						var itemType = obj.itemType;
						if(itemType == 1){
			    			$("form[name=form1]").attr("action","<%=basePath %>tjsinfo/tjsoa/xingzhengfawen/nigaofrom.do?state=1");
			    		}else if(itemType == 2){
			    			$("form[name=form1]").attr("action","<%=basePath %>tjsinfo/tjsoa/dangweifawen/nigaofrom.do?state=1");
			 		} 
			});
    		
    	}
    	
    	function frompostsubmit(){
	
					$("form[name=form1]").submit();
    	}
    	
    	function deletedoc(url){
    		Ext.MessageBox.show({
			           title:'消息',
			           msg: '是否执行此操作?',
			           buttons: Ext.MessageBox.YESNO,
			           fn: function(btn){
			           	  if(btn == 'yes'){
			           	  	$("form[name=form1]").attr("action",url);
    						$("form[name=form1]").submit();
			           	  }	
			           },
			           icon: Ext.MessageBox.QUESTION
			 });	
    		
    	}
    </script>
  <title>粮油集团办公自动化协作平台</title>
<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" />

</head>
<body onload="initarray()">
 <div id="component" style="width:100%;height:100%">
<div id="rightindex"  style="overflow-x:hidden;overflow-y: scroll; "  >

   <div id="tab_n"> 
 
    	 <div id="indextit_n"><h1>需参加会议</h1></div>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sss">
    		<tr>
				<td width="30%" style="text-align: center">会议名称</td>
				<td width="20%" style="text-align: center">开始时间</td>
				<td width="10%" style="text-align: center">持续时间</td>
				<td width="20%" style="text-align: center">会议室名称</td>
				<td width="10%" style="text-align: center">状态</td>
				<td width="20%" style="text-align: center">操作</td>
			</tr>
			<%
			int b = 1;
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
			for (Iterator iterator2 = infos2.iterator(); iterator2.hasNext();) {
			MeetingIncept mre2 = (MeetingIncept) iterator2.next();
			String name2 = mre2.getMeetingRoomEmploy().getMeetingName();
			if(mre2.getMeetingRoomEmploy().getMeetingName().length()>14)mre2.getMeetingRoomEmploy().setMeetingName(name2.substring(0,14));
			String roomName2 = mre2.getMeetingRoomEmploy().getMeetingRoomMain().getMeetingroomName();
			if(mre2.getMeetingRoomEmploy().getMeetingRoomMain().getMeetingroomName().length()>9)mre2.getMeetingRoomEmploy().getMeetingRoomMain().setMeetingroomName(roomName2.substring(0,9));
			String state2 = "<font color='red'>未阅</font>";
			if(mre2.getState()==1)state2 = "已阅";
			if (b % 2 == 0) {
			%>
			<tr bgcolor="#F4F4F4">
				<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre2.getMeetingRoomEmploy().getId() %>&type=my"><%=mre2.getMeetingRoomEmploy().getMeetingName() %></a></td>
				<td style="text-align: center"><%=sdf.format(mre2.getMeetingRoomEmploy().getStartTime()) %></td>
				<td style="text-align: center"><%=mre2.getMeetingRoomEmploy().getEndTime() %>小时</td>
				<td style="text-align: center"><a title="<%=roomName2 %>"><%=mre2.getMeetingRoomEmploy().getMeetingRoomMain().getMeetingroomName() %></a></td>
				<td style="text-align: center"><%=state2 %></td>
				<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre2.getMeetingRoomEmploy().getId() %>&type=my">查看</a>&nbsp;</td>
			</tr>
			<%
			} else {
			%>
			<tr>
				<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre2.getMeetingRoomEmploy().getId() %>&type=my"><%=mre2.getMeetingRoomEmploy().getMeetingName() %></a></td>
				<td style="text-align: center"><%=sdf.format(mre2.getMeetingRoomEmploy().getStartTime()) %></td>
				<td style="text-align: center"><%=mre2.getMeetingRoomEmploy().getEndTime() %>小时</td>
				<td style="text-align: center"><a title="<%=roomName2 %>"><%=mre2.getMeetingRoomEmploy().getMeetingRoomMain().getMeetingroomName() %></a></td>
				<td style="text-align: center"><%=state2 %></td>
				<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre2.getMeetingRoomEmploy().getId() %>&type=my">查看</a>&nbsp;</td>
			</tr>
			<%
			}
			b++;
			}
			%>
			<tr align="center">
				<td colspan="7" style="border-bottom: 1px #d0d0d0 solid">
					<div class="page01">
					共<%=paginationSupport2.getTotalCount()%>条,共<%=paginationSupport2.getPageCount()%>页&nbsp;&nbsp;
					当前为第<%=pageNo2 + 1%>页&nbsp;&nbsp;
					<%
					if (paginationSupport2.getStartIndex() > 1) {
					%>
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/myMeeting.do?pageNo=<%=pageNo2 - 1%>">上一页</a>
					<%
					}
					%>
					<%
					if (paginationSupport2.getStartIndex()+ paginationSupport2.getPageSize() < paginationSupport2.getTotalCount()) {
					%>
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/myMeeting.do?pageNo=<%=pageNo2 + 1%>">下一页</a>
					<%
					}
					%>
					&nbsp;&nbsp; 跳转到
					<select name="selectPage" id="selectPage" onchange="submitpages2(this.value)">
						<option value="0">--跳转--</option>
						<%
						for (int pii = 0; pii < paginationSupport2.getPageCount(); pii++) {
						%>
						<option value="<%=pii%>"><%=pii + 1%></option>
						<%
						}
						%>
					</select>
					页
				</div>
				</td>
			</tr>
			</table>
			
		<div id="indextit_n"><h1>需审批会议</h1></div>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sss">
    		<tr>
				<td width="50%" style="text-align: center">会议室名称</td>
				<td width="50%" style="text-align: center">操作</td>
			</tr>
			<%
			int c= 1;
			for (Iterator iterator = roomList.iterator(); iterator.hasNext();) {
			MeetingRoomEmploy employ = (MeetingRoomEmploy) iterator.next();
			if (c % 2 == 0) {
			%>
			<tr bgcolor="#F4F4F4">
				<td style="text-align: center">
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/empolyList.do?roomId=<%=employ.getMeetingRoomMain().getId() %>">
						<%=employ.getMeetingRoomMain().getMeetingroomName() %>
					</a>
				</td>
				<td style="text-align: center">
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/empolyList.do?roomId=<%=employ.getMeetingRoomMain().getId() %>">查看</a>
                </td>
			</tr>
			<%
			} else {
			%>
			<tr>
				<td style="text-align: center">
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/empolyList.do?roomId=<%=employ.getMeetingRoomMain().getId() %>">
						<%=employ.getMeetingRoomMain().getMeetingroomName() %>
					</a>
				<td style="text-align: center">
					<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/empolyList.do?roomId=<%=employ.getMeetingRoomMain().getId() %>">查看</a>
                </td>
			</tr>
			<%
			}
			c++;
			}
			%>
			<tr>
				<td style="text-align: center">&nbsp;</td>
				<td style="text-align: center">&nbsp;</td>
			</tr>
    	</table >
    	
    	<div id="indextit_n"><h1>所申请会议</h1></div>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sss">
    		<tr>
				<td width="15%" style="text-align: center">申请日期</td>
				<td width="30%" style="text-align: center">会议名称</td>
				<td width="15%" style="text-align: center">开始时间</td>
				<td width="10%" style="text-align: center">持续时间</td>
				<td width="20%" style="text-align: center">会议室名称</td>
				<td width="10%" style="text-align: center">状态</td>
			</tr>
		<%
		int a = 1;
		for (Iterator iterator1 = infos1.iterator(); iterator1.hasNext();) {
			MeetingRoomEmploy mre1 = (MeetingRoomEmploy) iterator1.next();
			String name1 = mre1.getMeetingName();
			if(mre1.getMeetingName().length()>12)mre1.setMeetingName(name1.substring(0,12));
			String roomName1 = mre1.getMeetingRoomMain().getMeetingroomName();
			if(mre1.getMeetingRoomMain().getMeetingroomName().length()>7)mre1.getMeetingRoomMain().setMeetingroomName(roomName1.substring(0,7));
			String place1 = mre1.getMeetingRoomMain().getPlace();
			if (a % 2 == 0) {
		%>
        <tr>
            <td style="text-align: center"><%=mre1.getEmpolyTime() %></td>
			<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre1.getId() %>" title="<%=name1 %>"><%=mre1.getMeetingName() %></a></td>
			<td style="text-align: center"><%=sdf.format(mre1.getStartTime()) %></td>
			<td style="text-align: center"><%=mre1.getEndTime() %>小时</td>
			<td style="text-align: center"><a title="<%=roomName1 %>"><%=roomName1 %></a></td>
			<%if("1".equals(mre1.getState())){ %>
			<td style="text-align: center">预定成功</td>
			<%}else if("2".equals(mre1.getState())){ %>
			<td style="text-align: center">已使用</td>
			<%}else if("3".equals(mre1.getState())){ %>
			<td style="text-align: center">待审批</td>
			<%}else if("0".equals(mre1.getState())){ %>
			<td style="text-align: center">未通过</td>
			<%}  %>
        </tr>
    	<%
		} else {
		%>
		<tr>
			<td style="text-align: center"><%=mre1.getEmpolyTime() %></td>
			<td style="text-align: center"><a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre1.getId() %>" title="<%=name1 %>"><%=mre1.getMeetingName() %></a></td>
			<td style="text-align: center"><%=sdf.format(mre1.getStartTime()) %></td>
			<td style="text-align: center"><%=mre1.getEndTime() %>小时</td>
			<td style="text-align: center"><a title="<%=roomName1 %>"><%=roomName1 %></a></td>
			<%if("1".equals(mre1.getState())){ %>
			<td style="text-align: center">预定成功</td>
			<%}else if("2".equals(mre1.getState())){ %>
			<td style="text-align: center">已使用</td>
			<%}else if("3".equals(mre1.getState())){ %>
			<td style="text-align: center">待审批</td>
			<%}else if("0".equals(mre1.getState())){ %>
			<td style="text-align: center">未通过</td>
			<%}  %>
		</tr>
		<%
		}
		a++;
		}
		%>
		<tr align="center">
			<td colspan="6" style="border-bottom: 1px #d0d0d0 solid">
				<div class="page01">
					共<%=paginationSupport1.getTotalCount()%>条,共<%=paginationSupport1.getPageCount()%>页&nbsp;&nbsp;
					当前为第<%=pageNo1 + 1%>页&nbsp;&nbsp;
					<%
					if (paginationSupport1.getStartIndex() > 1) {
					%>
					<a
						href="<%=basePath%>tjsinfo/tjsoa/meetingroom/applicationMeeting.do?pageNo=<%=pageNo1 - 1%>">上一页</a>
					<%
					}
					%>
					<%
					if (paginationSupport1.getStartIndex()
						+ paginationSupport1.getPageSize() < paginationSupport1
						.getTotalCount()) {
					%>
					<a
						href="<%=basePath%>tjsinfo/tjsoa/meetingroom/applicationMeeting.do?pageNo=<%=pageNo1 + 1%>">下一页</a>
					<%
					}
					%>
					&nbsp;&nbsp; 跳转到
					<select name="selectPage" id="selectPage" onchange="submitpages1(this.value)">
						<option value="0">--跳转--</option>
						<%
						for (int pi = 0; pi < paginationSupport1.getPageCount(); pi++) {
						%>
						<option value="<%=pi%>"><%=pi + 1%></option>
						<%
						}
						%>
					</select>
					页
				</div>
			</td>
		</tr>
    	</table>
</div>
</div>
</body>
</html>

